//
//  SharePreferencesHelper.m
//  TableBarControllerDemo
//
//  Created by 边果互动 on 2021/3/26.
//

#import "SharePreferencesHelper.h"

@interface SharePreferencesHelper ()

@property (nonatomic, strong) NSUserDefaults *userDefealuts;

@end

@implementation SharePreferencesHelper

+ (instancetype) defaultSph {
    return [self new];
}

#pragma mark - 单例模式
+ (instancetype)allocWithZone:(struct _NSZone *)zone {
    static SharePreferencesHelper *helper = nil;
    if (nil == helper) {
        helper = [super allocWithZone:zone];
        helper.userDefealuts = [NSUserDefaults standardUserDefaults];
    }
    return helper;
}

#pragma mark - 保存token
- (void) setToken: (NSString *) token {
    [self.userDefealuts setObject:token forKey:@"token"];
}
- (NSString *) getToken {
    return [self.userDefealuts objectForKey:@"token"];
}
@end
